<template>
  <page-layout>
    <a-row :gutter="[10, 10]">
      <!-- 顶部区域 -->
      <a-col :span="24">
        <a-card>
          <div class="box-ver-hor-between">
            <div class="primary-color">{{t(`content-manage.label.contentManage`)}}</div>
          </div>
        </a-card>
      </a-col>
      <!-- 中心区域 -->
      <a-col :span="24">
        <a-card>
          <div class="mb-20">
            <!-- 查询参数 -->
            <pro-query :searchParam="searchParam"
                       :labelCol="{ span: 10 }"
                       :wrapperCol="{ span: 14 }"
                       @on-search="search"
            />
          </div>
          <!-- 列表 -->
          <pro-table
            ref="tableRef"
            :fetch="fetch"
            :columns="columns"
            :operate="operate"
            :param="state.param"
            :pagination="pagination"
            :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
          />
        </a-card>
      </a-col>
    </a-row>
  </page-layout>
</template>

<script setup>
import { tree } from "@/api/module/dept"
import { reactive } from 'vue'
import { useI18n } from "vue-i18n";
const { t } = useI18n();

const addForm = () => {
  this.$router.push({
    path: '/activity/activity-management/activity-management-add'
  })
  console.log('hi')
}

const fetch = async (param) => {
  const response = await tree(param)
  return {
    // data: response.data
    data: [{
      name: '营销活动AAAA',
      remark: '家里看风景时打开链接福克斯方法尽快交电费框架框架',
      time: '2021-08-27 19:28',
    }]
  };
};

const columns = [
  { dataIndex: "name", key: "name", title: "类别" },
  { dataIndex: "remark", key: "remark", width: 300, ellipsis: true, title: "说明" },
  { dataIndex: "time", key: "time", title: "修改时间" },
]

const operate = [
  {
    label: "编辑",
    event: function (record) {
      console.log('record: 编辑', record);
    }
  },
]

const searchParam = reactive([
  { key: "keyword", type: "input", label: "关键字", placeholder: '请输入' },

])

const state = reactive({
  selectedRowKeys: [],
  param: {},
  visibleSave: false,
  visibleEdit: false,
  visibleInfo: false,
  recordEdit: {},
  recordInfo: {},
})
// 分页参数
const pagination = { pageNum: 1, pageSize: 10 };
</script>

<style scoped>

</style>
